﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DMT.App_Site.Modules;
using DMT.App_Site.DmtController.Constant;

namespace DMT.View
{
    public partial class Index : System.Web.UI.Page
    {
        /// <summary>
        /// author : HieuDinh
        /// date : 03/13/2011
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                LoadHeader();
                if (Context.Session[DmtSessionName.USER_NAME] == null
                 || Context.Session[DmtSessionName.USER_PASS] == null)
                {
                    LoadLogin();
                    Context.Session[DmtSessionName.USER_NAME] = "nhovehanoi_hieu2006@yahoo.com";
                    Context.Session[DmtSessionName.USER_PASS] = "abc";
                }
                else
                {
                    LoadMenuLeft();
                    LoadContent();
                    LoadMenuRight();
                }



                LoadFooter();
            }
            catch (Exception ex) 
            {
                
            }
            
        }

        /// <summary>
        /// author : HieuDinh
        /// date : 03/13/2011
        /// </summary>
        private void LoadHeader()
        {
            Header_Dynamic.Controls.Add((UserControl)LoadControl("~/App_Site/Modules/Employee/Header.ascx"));
        }

        /// <summary>
        /// author : HieuDinh
        /// date : 03/13/2011
        /// </summary>
        private void LoadFooter()
        {
            Footer_Dynamic.Controls.Add((UserControl)LoadControl("~/App_Site/Modules/Employee/Footer.ascx"));
        }

        /// <summary>
        /// author : HieuDinh
        /// date : 03/13/2011
        /// </summary>
        private void LoadLogin()
        {
            Login_Dynamic.Controls.Add((UserControl)LoadControl("~/App_Site/Modules/Employee/Login.ascx"));
        }


        /// <summary>
        /// author : HieuDinh
        /// date : 03/13/2011
        /// </summary>
        private void LoadMenuLeft()
        {
            Menu_Left_Dynamic.Controls.Add((UserControl)LoadControl("~/App_Site/Modules/Employee/Menu_Left.ascx"));
        }

        /// <summary>
        /// author : HieuDinh
        /// date : 03/13/2011
        /// </summary>
        private void LoadMenuRight()
        {
            Menu_Right_Dynamic.Controls.Add((UserControl)LoadControl("~/App_Site/Modules/Employee/Menu_Right.ascx"));
        }

        /// <summary>
        /// author : HieuDinh
        /// date : 03/13/2011
        /// </summary>
        private void LoadContent()
        {
            Content_Dynamic.Controls.Add((UserControl)LoadControl("~/App_Site/Modules/Employee/Content.ascx"));
        }
    }
}